package com.example.springbootjpasqllogdemo.common.exception;

import com.example.springbootjpasqllogdemo.common.result.ResultEnum;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

/**
 * 业务异常类
 *
 * @author Lv
 * @date 2022/10/11
 */
@Getter
@Setter
@AllArgsConstructor
@NoArgsConstructor
public class BusinessException extends RuntimeException {
    /**
     * 通用返回值枚举
     */
    private ResultEnum resultEnum;

    /**
     * 统一异常抛出方法
     *
     * @param resultEnum 通用返回值枚举
     */
    public static void exception(ResultEnum resultEnum) {
        throw new BusinessException(resultEnum);
    }
}
